Sub x_fill_right()

Application.OnKey "^R", "x_fill_right"
application.screenupdating = false

    last_col = 16000
    
    row_num = Selection.Rows.Count
    col = Selection.Columns.Count

     cell_start = Selection.Cells(1, 1)            ' define the title
    
    org_col = Selection.Cells(1, 1).column
    org_row = Selection.Cells(1, 1).row
       
      
    up_move = 1
    
copy_process:
    
' find the base for copying

    on error goto exit1
    Cells(org_row - up_move, org_col).Select
    
    Selection.End(xlToRight).Select
    
    end_col = ActiveCell.column
    end_row = ActiveCell.row
    
'    MsgBox end_row & "   " & end_col
'    MsgBox end_row + 1 & "   " & org_col
        
' check if have to go up further
        
    If end_col > last_col Then
        up_move = up_move + 1
        If org_row - up_move > 1 Then GoTo copy_process
    End If
        	
    For row = org_row To org_row + row_num - 1
        
        Range(Cells(row, org_col), Cells(row, end_col)).Select
        Selection.FillRight

    Next row

    Cells(org_row, org_col).Activate

exit1:
End Sub
